// 视频中心 相关的api接口

import service from '@/utils/request'
import constant from '@/utils/constant'
import Qs from 'qs'

const root = (process.env.NODE_ENV === 'development' ? '/api' : '')

 
 
// 查询直播url
export function getVideourl(params) {
  return service({
    url: root + constant.get_videourl,
    method: 'get',
    params: params
  })
}

// 查询直播 upload_videobase64
export function uploadVideobase64(data) {
  return service({
    url: root + constant.upload_videobase64,
    method: 'post',
    data: data
  })
}


// 查询资源列表
export function listDownload(params) {
  return service({
    url: root + constant.list_download,
    method: 'get',
    params: params
  })
}
// 下载资源
export function sureDownload(data) {
  return service({
    url: root + constant.sure_download,
    method: 'post',
    params: data
  })
}
// 查询资源来源
export function sourceDownload(params) {
  return service({
    url: root + constant.source_download,
    method: 'get',
    params: params
  })
}
// 查询资源类型
export function typeDownload(params) {
  return service({
    url: root + constant.type_download,
    method: 'get',
    params: params
  })
}
// 删除资源
export function delDownload(data) {
  return service({
    url: root + constant.del_download,
    method: 'delete',
    params: data
  })
}

// 添加轮播规则
export function addRotationRules(data) {
  return service({
    url: root + constant.add_rotationRules,
    method: 'post',
    data: data
  })
}

// 查询轮播规则
export function selectRotationRules(data) {
  return service({
    url: root + constant.select_rotationRules,
    method: 'get',
    data: data
  })
}

// 删除轮播规则
export function deleteRotationRules(data) {
  return service({
    url: root + constant.delete_rotationRules,
    method: 'delete',
    params: {
      slideIds: data
    },
    paramsSerializer: params => {
      return Qs.stringify(params, { arrayFormat: 'repeat' })
    }
  })
}

// 查询轮播流
export function selectRotationStream(data) {
  return service({
    url: root + constant.select_rotationStream,
    method: 'get',
    data: data,
    timeout: 60000
  })
}

// 查询历史回放文件列表
export function getVideoListByCon(data) {
  return service({
    url: root + constant.select_VideoListByCon,
    method: 'get',
    params: data
  })
}

// 控制回放流
export function ControlPlaybackStream(data) {
  return service({
    url: root + constant.select_ControlPlaybackStream,
    method: 'get',
    params: data
  })
}

// 获取回放流
export function getPlaybackStream(data) {
  return service({
    url: root + constant.select_PlaybackStream,
    method: 'get',
    params: data
  })
}